<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML3.2 EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="DOCTEXT">
<TITLE>MPI_Init</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
<H1 id="MPI_Init">MPI_Init</H1>
Initialize the MPI execution environment 
<H2>Synopsis</H2>
<PRE>
</PRE>
<PRE>
int MPI_Init(int *argc, char ***argv)
</PRE>

<P>
<H2>Input/Output Parameters</H2>
<DL>
<DT><B>argc </B> <DD> argc (None)

<DT><B>argv </B> <DD> argv (None)
</DL>
<P>
<H2>Notes</H2>
The MPI standard does not say what a program can do before an <tt>MPI_INIT</tt> or
after an <tt>MPI_FINALIZE</tt>.  In the MPICH implementation, you should do
as little as possible.  In particular, avoid anything that changes the
external state of the program, such as opening files, reading standard
input or writing to standard output.
<P>
<H2>Thread and Signal Safety</H2>
This routine must be called by one thread only.  That thread is called
the <em>main thread</em> and must be the thread that calls <tt>MPI_Finalize</tt>.
<P>
<H2>Notes for C</H2>
As of MPI-2, <tt>MPI_Init</tt> will accept NULL as input parameters. Doing so
will impact the values stored in <tt>MPI_INFO_ENV</tt>.
<P>
<H2>Notes for Fortran</H2>
The Fortran binding for <tt>MPI_Init</tt> has only the error return
<PRE>
    subroutine MPI_INIT(ierr)
    integer ierr
</PRE>

<P>
<H2>Errors</H2>
<P>
All MPI routines (except <tt>MPI_Wtime</tt> and <tt>MPI_Wtick</tt>) return an error value;
C routines as the value of the function and Fortran routines in the last
argument.  Before the value is returned, the current MPI error handler is
called.  By default, this error handler aborts the MPI job.  The error handler
may be changed with <tt>MPI_Comm_set_errhandler</tt> (for communicators),
<tt>MPI_File_set_errhandler</tt> (for files), and <tt>MPI_Win_set_errhandler</tt> (for
RMA windows).  The MPI-1 routine <tt>MPI_Errhandler_set</tt> may be used but
its use is deprecated.  The predefined error handler
<tt>MPI_ERRORS_RETURN</tt> may be used to cause error values to be returned.
Note that MPI does <em>not</em> guarantee that an MPI program can continue past
an error; however, MPI implementations will attempt to continue whenever
possible.
<P>
<DL>
<DT><B>MPI_SUCCESS </B> <DD> No error; MPI routine completed successfully.
</DL>
<DL>
<DT><B>MPI_ERR_OTHER </B> <DD> Other error; use <tt>MPI_Error_string</tt> to get more information
about this error code. 
</DL>
<P>
<H2>See Also</H2>
 MPI_Init_thread, MPI_Finalize
<br>
</BODY></HTML>
